package com.example.shopingcenter.usercenter;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

import com.example.shopingcenter.R;

import java.util.Random;

public class ForgetPassword extends AppCompatActivity {
    Button btnxiuganpwd;
    EditText forgetphone, forgetyanzhenma, forgetnewpwd;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_forget_password);

        findView();


        btnxiuganpwd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if ((forgetnewpwd.getText().toString().equals("")) || (forgetphone.getText().toString().equals("")) || (forgetyanzhenma.getText().toString().equals(""))) {
                    Toast.makeText(ForgetPassword.this, "手机号或验证码或密码为空，请重新输入", Toast.LENGTH_SHORT).show();
                } else {
                    Toast.makeText(ForgetPassword.this, "修改密码成功，3秒后返回登录中心", Toast.LENGTH_SHORT).show();
                    Handler handler = new Handler();
                    Runnable runnable = new Runnable() {
                        @Override
                        public void run() {
                            Intent intent = new Intent(ForgetPassword.this, UserCenterLogin.class);
                            startActivity(intent);
                        }
                    };
                    handler.postDelayed(runnable, 3000);

                }
            }
        });


    }

    private void findView() {

        forgetnewpwd = findViewById(R.id.forgetnewpwd);
        forgetphone = findViewById(R.id.forgetphone);
        btnxiuganpwd = findViewById(R.id.btnxiuganpwd);

    }
}